<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

</body>
<script src="js/jquery-3.3.1.min.js"></script>
<script>
    $.ajax({
        url:'/demo2',
        type:'post',
        //data:{"username":"123"},
       // contentType:'application/json;charset=utf-8',
        data:'{"id":"1","username":"admin","pwd":"333"}',
        //data:'username=value',
        success:function () {
            alert("ok")
        }
    })
</script>
</html>